import { defineConfig, splitVendorChunkPlugin } from "vite";
import react from "@vitejs/plugin-react";

// https://vitejs.dev/config/
export default defineConfig({
  server: {
    port: 8000,
    open: true,
    host: true,
  },
  preview: {
    port: 5000,
    host: true,
    open: true,
  },
  build: {
    chunkSizeWarningLimit: 1024,
    rollupOptions: {
      output: {
        chunkFileNames: "js/[name]-[hash].js",
        entryFileNames: "js/[name]-[hash].js",
        assetFileNames: (info) => "assets/[name]-[hash][extname]",
      },
    },
  },
  base: "./",
  plugins: [react(), splitVendorChunkPlugin()],
  resolve: {
    alias: {
      "@": "/src",
      "@components": "/src/components",
    },
  },
});
